<?php
class TrashIndexController  extends Zone_Action{
	/*
		Return a signal number in ajax for recyclebin
	*/
	public function indexAction(){
		$user_id = $_SESSION[USER];
		$data = array();
		
		//number of task had deleted
		$task_number = $this->Model->fetchOne("SELECT COUNT(*) as `total` FROM `tasks` WHERE `is_deleted`<>'0' AND `owner_id`='$user_id'");
		
		$data['html'] = $task_number;		
		return $this->setContent(json_encode($data));
	}

	public function checkAction(){
		$user_id = $_SESSION[USER];
		$data = array();
		
		//number of task had deleted
		$task_number = $this->Model->fetchOne("SELECT COUNT(*) as `total` FROM `tasks` WHERE `is_deleted`<>'0' AND `owner_id`='$user_id'");
		
		$data['html'] = $task_number;		
		return $this->setContent(json_encode($data));
	}
}	